/**
 * Created by tsy on 2017/4/7.
 */
function workdetail_show($status){
    if($status==1){
        $("#student").show();
    }else{
        $("#work").show();
    }
}

function ajax_borrow(cust_id){
    var url="../../customer/customer/ajax_borrow";
    var data={cust_id:cust_id};
    jQuery.axse(url,data,ajax_borrow_success,ajax_error);
}

function ajax_reference(cust_id){
    var url="../../customer/customer/ajax_reference";
    var data={cust_id:cust_id};
    jQuery.axse(url,data,ajax_reference_success,ajax_error);
}

function ajax_invest(cust_id){
    var url="../../customer/customer/ajax_invest";
    var data={cust_id:cust_id};
    jQuery.axse(url,data,ajax_invest_success,ajax_error);
}
function ajax_validate(cust_id){
    var url="../../customer/customer/ajax_validate";
    var data={cust_id:cust_id};
    jQuery.axse(url,data,ajax_validate_success,ajax_error);
}
function ajax_validate_success(json){
    var array = JSON.parse(json);
    $('#validate_table').datagrid({loadFilter:pagerFilter}).datagrid('loadData', array);
}
function ajax_invest_success(json){
    var array = JSON.parse(json);
    $('#invest_table').datagrid({loadFilter:pagerFilter}).datagrid('loadData', array);
}

function ajax_reference_success(json){
    var array = JSON.parse(json);
    $('#reference_table').datagrid({loadFilter:pagerFilter}).datagrid('loadData', array);
}

function ajax_borrow_success(json){
    var array = JSON.parse(json);
    $('#borrow_table').datagrid({loadFilter:pagerFilter}).datagrid('loadData', array);
}


function ajax_error(){
    alert("网络错误，请联系后台开发人员");
}

function format_reference(value,row,index)
{
    var c = '<input type="button" value="查看" class="btn_form" onclick="reference_check('+row.ref_id+');">';
    return c;
}

function reference_check(ref_id) {
    window.parent.addTab('审核附件','../../customer/customer/reference_check?ref_id='+ref_id);
}
function format_borrow(value,row,index){
    var c = '<input type="button" value="详情" class="btn_form" onclick="borrow_see('+row.borrow_id+','+row.borrow_status+');">';
    return c;
}

function borrow_see(borrow_id,borrow_status) {
    if(borrow_status==0){
        window.parent.addTab('借款详情', '../../borrow/borrow/borrow_see?borrow_id=' + borrow_id);
    }else if(borrow_status==2) {
        window.parent.addTab('借款详情', '../../borrow/borrow/borrow_see?borrow_id=' + borrow_id);
    }else{
        window.parent.addTab('借款详情', '../../borrow/borrow/borrow_see?borrow_id=' + borrow_id);
    }
}

function format_invest(value,row,index){
    var c = '<input type="button" value="详情" class="btn_form" onclick="investDetail_see('+row.invest_id+');">';
    return c;
}

function investDetail_see(invest_id)
{
    window.parent.addTab('投资项目详细信息','../../invest/invest/invest_see?invest_id='+invest_id);
}
function goto_basic(cust_id){
    window.parent.addTab('客户编辑','../../customer/customer/customer_basic?cust_id='+cust_id);
}
function goto_detail(cust_id){
    window.parent.addTab('客户编辑','../../customer/customer/customer_detail?cust_id='+cust_id);
}
function goto_linkman(cust_id){
    window.parent.addTab('客户编辑','../../customer/customer/customer_linkman?cust_id='+cust_id);
}
function goto_work(cust_id){
    window.parent.addTab('客户编辑','../../customer/customer/customer_work?cust_id='+cust_id);
}
